Skip to content

Conversation

@Saahi30
Copy link
Collaborator

@Saahi30 Saahi30 commented Nov 3, 2025

📝 Description

This PR implements a complete authentication system for InPactAI with role-based access control. The system supports two user types (Creator and Brand) with separate dashboards and includes signup, login, logout, and protected route functionality using Next.js 15, TypeScript, Supabase Auth, and Tailwind CSS v4.

Users can now:

  • Create accounts as either a Creator or Brand
  • Log in with email/password authentication
  • Access role-specific home pages
  • Enjoy a modern, responsive UI with real-time validation
  • Experience secure, protected routes with automatic redirects

🔧 Changes Made

Frontend (Next.js 15 + TypeScript)

New Pages:

  • Signup Page (/signup) - Complete registration flow with form validation
  • Login Page (/login) - Modern authentication interface
  • Creator Home (/creator/home) - Protected dashboard for creators
  • Brand Home (/brand/home) - Protected dashboard for brands

Components & Helpers:

  • ✅ Created AuthGuard component for route protection and role verification
  • ✅ Created auth-helpers.ts with utility functions:
    • getCurrentUser() - Get authenticated user
    • getUserProfile() - Fetch user profile from database
    • signOut() - Logout functionality
    • checkUserRole() - Verify user roles
    • getAuthErrorMessage() - User-friendly error mapping
  • ✅ Added middleware for basic routing logic

Features Implemented:

  • ✅ Real-time password strength indicator (Weak/Fair/Good/Strong)
  • ✅ Form validation using Zod schemas
  • ✅ Password visibility toggle
  • ✅ Role-based routing after login (Creator → /creator/home, Brand → /brand/home)
  • ✅ Protected routes with authentication and role checks
  • ✅ Loading states during async operations
  • ✅ User-friendly error messages
  • ✅ Success notifications with auto-redirect
  • ✅ Responsive design (mobile, tablet, desktop)

Design System:

  • ✅ Updated globals.css with custom primary color palette
  • ✅ Implemented gradient backgrounds (purple-50 → white → blue-50)
  • ✅ Added purple-to-blue gradient branding throughout
  • ✅ Integrated lucide-react icons
  • ✅ Smooth transitions and animations

Dependencies Added:

  • zod - Schema validation
  • react-hook-form - Form management
  • @hookform/resolvers - Zod integration

📷 Screenshots or Visual Changes (if applicable)

Signup Page

  • Modern gradient design with purple/blue theme
  • Real-time password strength indicator
  • Form validation with inline error messages
  • Success notification with auto-redirect
Screenshot 2025-11-04 at 12 38 51 AM

Login Page

  • Clean, minimal interface
  • Password visibility toggle
  • Clear error messaging
  • Role-based routing after authentication
Screenshot 2025-11-04 at 12 37 40 AM

User Home

  • Personalized welcome message
  • Protected route with role verification
Screenshot 2025-11-04 at 12 37 52 AM

🔐 Authentication Flow

Signup: User → Form Validation → Supabase Auth → Create Profile → Success → Redirect to Login Login: User → Credentials → Verify → Fetch Role → Route to /creator/home or /brand/home Access: User → Protected Route → AuthGuard → Check Auth & Role → Allow or Redirect

✅ Checklist

  • I have read the contributing guidelines.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if applicable).
  • Any dependent changes have been merged and published in downstream modules.

Summary by CodeRabbit

  • New Features

    • Full auth flow: signup, login, sign-out, client-side validation, password strength, role-based redirects, and backend auth endpoints.
    • Role-specific Brand and Creator dashboards with personalized greetings, CTAs, and logout flow.
    • Auth guard and helper utilities plus landing-page redirect based on auth state.
  • Chores

    • Added profiles DB table, example env entries (including service key), theme color tokens, middleware scaffold, and form-validation dependencies.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Warning

Rate limit exceeded

@Saahi30 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 53 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 5768858 and 44f1276.

📒 Files selected for processing (1)
  • backend/app/api/routes/auth.py (1 hunks)

Walkthrough

Adds Supabase-backed auth: example env and service key, a new profiles SQL table, FastAPI signup/login routes using public and service Supabase clients, frontend auth helpers and AuthGuard, middleware scaffold, login/signup pages with zod/react-hook-form, and role-based Creator/Brand home pages with logout flows.

Changes

Cohort / File(s) Summary
Environment & Config
backend/.env.example, backend/env_example
Adds example env vars including SUPABASE_SERVICE_KEY, SUPABASE_URL, SUPABASE_KEY, DB URL, AI keys, allowed origins, and server host/port.
Database Schema
backend/SQL/*
Adds profiles table: id UUID PK referencing auth.users(id) ON DELETE CASCADE, name text NOT NULL, role text CHECK IN ('Creator','Brand') NOT NULL, created_at timestamptz default timezone('utc', now()).
Backend Auth Routes & Config
backend/app/api/routes/auth.py, backend/app/core/config.py, backend/app/main.py
Adds FastAPI auth router with /api/auth/signup and /api/auth/login, Pydantic request/response models, initializes supabase_public and supabase_admin clients, adds supabase_service_key to settings, and registers the auth router.
Frontend Auth Helpers
frontend/lib/auth-helpers.ts
New UserProfile type and helper functions: getCurrentUser, getUserProfile, signOut, checkUserRole, and getAuthErrorMessage for Supabase interactions.
Auth Guard & Middleware
frontend/components/auth/AuthGuard.tsx, frontend/middleware.ts
Adds client-side AuthGuard enforcing auth and optional role checks with redirects; middleware scaffold that currently forwards requests and exports a config matcher.
Auth Pages (Login/Signup)
frontend/app/login/page.tsx, frontend/app/signup/page.tsx
Adds client Login and Signup pages using zod + react-hook-form, Supabase auth integration, profile creation flow, password visibility/strength UI, loading/error states, and role-based redirects.
Role Home Pages
frontend/app/brand/home/page.tsx, frontend/app/creator/home/page.tsx
Adds Brand and Creator home pages wrapped in AuthGuard (requiredRole), fetching profile on mount and providing logout flows via signOut.
Root Routing & Styling
frontend/app/page.tsx, frontend/app/globals.css
Root page performs auth check and redirects to role-specific homes or /login with loading UI; globals.css adds primary color scale CSS custom properties and theme mappings.
Frontend Dependencies
frontend/package.json
Adds react-hook-form ^7.66.0, zod ^4.1.12, and @hookform/resolvers ^5.2.2 to dependencies.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant LoginPage as Login Page
    participant SupabaseAuth as Supabase Auth
    participant ProfilesDB as Profiles DB
    participant Router

    User->>LoginPage: submit email & password
    LoginPage->>SupabaseAuth: signInWithPassword()
    alt auth success
        SupabaseAuth-->>LoginPage: user object
        LoginPage->>ProfilesDB: select role by user.id
        alt profile found
            ProfilesDB-->>LoginPage: profile (role)
            LoginPage->>Router: navigate to role-specific home
        else profile missing
            LoginPage-->>User: show profile missing error
        end
    else auth failed
        SupabaseAuth-->>LoginPage: error
        LoginPage-->>User: show friendly auth error
    end
Loading
sequenceDiagram
    participant Browser
    participant AuthGuard
    participant Supabase as getCurrentUser()
    participant Profiles as getUserProfile()
    participant Router

    Browser->>AuthGuard: access protected page
    AuthGuard->>Supabase: getCurrentUser()
    alt no user
        AuthGuard->>Router: redirect /login
    else user present
        Supabase-->>AuthGuard: user
        AuthGuard->>Profiles: getUserProfile()
        alt role matches requiredRole
            Profiles-->>AuthGuard: profile
            AuthGuard-->>Browser: render children
        else mismatch or missing
            AuthGuard->>Router: redirect to actual-role home
        end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Pay extra attention to:
    • backend/app/api/routes/auth.py — transactional semantics, error handling, and correct use of public vs service keys.
    • frontend/lib/auth-helpers.ts and frontend/components/auth/AuthGuard.tsx — null/undefined handling and redirect logic.
    • frontend/app/signup/page.tsx and frontend/app/login/page.tsx — form validation, race conditions during redirects, and user-facing error mapping.
    • SQL constraints — FK and role CHECK alignment with auth provider user IDs.

Possibly related PRs

Poem

🐇 I hopped through env and SQL rows bright,

I stitched signup routes and pages alight,
Guards keep watch while profiles grow,
Roles find homes and logouts go,
A carrot-toast — auth now takes flight! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main objective of the PR: implementing a login and role-based authentication system. It directly aligns with the comprehensive auth system changes across frontend and backend.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Saahi30
Copy link
Collaborator Author

Saahi30 commented Nov 3, 2025

@CodeRabbit review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
frontend/app/globals.css (1)

6-30: Verify color palette completeness against PR design objectives.

The primary color scale is correctly structured for Tailwind v4, but the PR objectives mention "purple-to-blue branding" whereas the CSS only defines a purple palette. There is no secondary blue/accent color scale defined.

Confirm whether:

  1. Blue colors are intentionally deferred to a later phase, or
  2. A complementary blue/accent palette should be added now (e.g., --secondary-* or --accent-* tokens).

Additionally, verify that these color tokens are being actively consumed in the new authentication components (login, signup, and role-specific dashboards). If unused at this stage, they can be deferred.

frontend/middleware.ts (1)

8-19: Tidy up unused middleware flags

publicRoutes/isPublicRoute and isProtectedRoute are computed but never used, and the middleware always falls through to NextResponse.next(). Either wire these checks into a redirect/early return or drop the dead code so the intent of the middleware stays clear.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b444863 and bc9bc96.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • backend/.env.example (1 hunks)
  • backend/SQL (1 hunks)
  • frontend/app/brand/home/page.tsx (1 hunks)
  • frontend/app/creator/home/page.tsx (1 hunks)
  • frontend/app/globals.css (1 hunks)
  • frontend/app/login/page.tsx (1 hunks)
  • frontend/app/page.tsx (1 hunks)
  • frontend/app/signup/page.tsx (1 hunks)
  • frontend/components/auth/AuthGuard.tsx (1 hunks)
  • frontend/lib/auth-helpers.ts (1 hunks)
  • frontend/middleware.ts (1 hunks)
  • frontend/package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-05-07T21:28:06.358Z
Learnt from: muntaxir4
Repo: AOSSIE-Org/InPactAI PR: 56
File: Backend/app/services/redis_client.py:1-4
Timestamp: 2025-05-07T21:28:06.358Z
Learning: Hardcoded Redis connection parameters in Backend/app/services/redis_client.py are intentional during development, with plans to implement environment variable configuration later during production preparation.

Applied to files:

  • backend/.env.example
🪛 dotenv-linter (4.0.0)
backend/.env.example

[warning] 5-5: [ExtraBlankLine] Extra blank line detected

(ExtraBlankLine)


[warning] 8-8: [UnorderedKey] The SUPABASE_KEY key should go before the SUPABASE_URL key

(UnorderedKey)


[warning] 10-10: [ExtraBlankLine] Extra blank line detected

(ExtraBlankLine)


[warning] 17-17: [UnorderedKey] The AI_API_KEY key should go before the GROQ_API_KEY key

(UnorderedKey)

@Saahi30
Copy link
Collaborator Author

Saahi30 commented Nov 3, 2025

@CodeRabbit review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (2)
backend/app/api/routes/auth.py (2)

6-8: Consider dependency injection for the Supabase client.

While module-level initialization works, FastAPI best practices favor dependency injection for better testability and lifecycle management.


10-14: Consider stronger password requirements.

A minimum password length of 8 characters meets basic standards but is below modern security best practices. Consider increasing to 12 or adding complexity requirements.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc9bc96 and 4f78b01.

📒 Files selected for processing (1)
  • backend/app/api/routes/auth.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.14.3)
backend/app/api/routes/auth.py

36-36: Abstract raise to an inner function

(TRY301)


49-49: Abstract raise to an inner function

(TRY301)


52-52: Do not catch blind exception: Exception

(BLE001)


53-53: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


53-53: Use explicit conversion flag

Replace with conversion flag

(RUF010)

@Saahi30
Copy link
Collaborator Author

Saahi30 commented Nov 3, 2025

@CodeRabbit review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f78b01 and c63037b.

📒 Files selected for processing (6)
  • backend/.env.example (1 hunks)
  • backend/app/api/routes/auth.py (1 hunks)
  • backend/app/core/config.py (1 hunks)
  • backend/app/main.py (2 hunks)
  • backend/env_example (1 hunks)
  • frontend/app/signup/page.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-05-07T21:28:06.358Z
Learnt from: muntaxir4
Repo: AOSSIE-Org/InPactAI PR: 56
File: Backend/app/services/redis_client.py:1-4
Timestamp: 2025-05-07T21:28:06.358Z
Learning: Hardcoded Redis connection parameters in Backend/app/services/redis_client.py are intentional during development, with plans to implement environment variable configuration later during production preparation.

Applied to files:

  • backend/.env.example
🪛 dotenv-linter (4.0.0)
backend/.env.example

[warning] 5-5: [ExtraBlankLine] Extra blank line detected

(ExtraBlankLine)


[warning] 8-8: [UnorderedKey] The SUPABASE_KEY key should go before the SUPABASE_URL key

(UnorderedKey)


[warning] 9-9: [UnorderedKey] The SUPABASE_SERVICE_KEY key should go before the SUPABASE_URL key

(UnorderedKey)


[warning] 11-11: [ExtraBlankLine] Extra blank line detected

(ExtraBlankLine)


[warning] 18-18: [UnorderedKey] The AI_API_KEY key should go before the GROQ_API_KEY key

(UnorderedKey)

🪛 Ruff (0.14.3)
backend/app/api/routes/auth.py

45-45: Abstract raise to an inner function

(TRY301)


61-61: Do not catch blind exception: Exception

(BLE001)


68-71: Abstract raise to an inner function

(TRY301)


72-72: Abstract raise to an inner function

(TRY301)


78-78: Use explicit conversion flag

Replace with conversion flag

(RUF010)


116-116: Abstract raise to an inner function

(TRY301)


117-117: Abstract raise to an inner function

(TRY301)


119-119: Abstract raise to an inner function

(TRY301)


125-125: Abstract raise to an inner function

(TRY301)


135-135: Use raise without specifying exception name

Remove exception name

(TRY201)


136-136: Do not catch blind exception: Exception

(BLE001)


137-137: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


137-137: Use explicit conversion flag

Replace with conversion flag

(RUF010)

@Saahi30
Copy link
Collaborator Author

Saahi30 commented Nov 3, 2025

@CodeRabbit review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
backend/app/api/routes/auth.py (2)

2-2: Remove unused import.

The constr import is not used anywhere in the file. All string constraints are defined using Field with validation parameters.

Apply this diff:

-from pydantic import BaseModel, EmailStr, constr,Field
+from pydantic import BaseModel, EmailStr, Field

31-79: Signup logic is robust and well-structured.

The endpoint correctly implements:

  • Email verification flow (Supabase sends verification email automatically)
  • Proper client separation (public for auth, admin for profile and rollback)
  • Defensive error handling with retries for rollback operations
  • Appropriate exception chaining to preserve error context

All previous critical issues have been addressed effectively.

Minor suggestion: Consider adding a small delay between rollback retry attempts to handle transient network issues more gracefully:

import asyncio

for attempt in range(2):
    try:
        supabase_admin.auth.admin.delete_user(user.id)
        break
    except Exception as rollback_err:
        rollback_error = rollback_err
        if attempt == 0:
            await asyncio.sleep(0.5)  # Brief delay before retry
            continue
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c63037b and 57df8d0.

📒 Files selected for processing (1)
  • backend/app/api/routes/auth.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.14.3)
backend/app/api/routes/auth.py

46-46: Abstract raise to an inner function

(TRY301)


62-62: Do not catch blind exception: Exception

(BLE001)


69-72: Abstract raise to an inner function

(TRY301)


73-73: Abstract raise to an inner function

(TRY301)


79-79: Use explicit conversion flag

Replace with conversion flag

(RUF010)


117-117: Abstract raise to an inner function

(TRY301)


118-118: Abstract raise to an inner function

(TRY301)


120-120: Abstract raise to an inner function

(TRY301)


126-126: Abstract raise to an inner function

(TRY301)


136-136: Use raise without specifying exception name

Remove exception name

(TRY201)


137-137: Do not catch blind exception: Exception

(BLE001)


138-138: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


138-138: Use explicit conversion flag

Replace with conversion flag

(RUF010)

🔇 Additional comments (3)
backend/app/api/routes/auth.py (3)

7-10: Excellent separation of concerns!

Using separate clients for public auth flows and admin operations is the correct approach. This ensures that privileged operations like delete_user and RLS-bypassed table access work reliably.


13-28: Well-structured request/response models.

The Pydantic models include appropriate validation constraints (email format, minimum lengths, role pattern matching) and clear documentation. The field constraints align well with security best practices.


122-126: Profile fetching is correctly implemented.

Using the admin client to fetch profile data ensures the query bypasses RLS. The defensive error handling and specific field selection are appropriate.

@Saahi30
Copy link
Collaborator Author

Saahi30 commented Nov 3, 2025

@CodeRabbit review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57df8d0 and bad59d0.

📒 Files selected for processing (1)
  • backend/app/api/routes/auth.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.14.3)
backend/app/api/routes/auth.py

46-46: Abstract raise to an inner function

(TRY301)


62-62: Do not catch blind exception: Exception

(BLE001)


69-72: Abstract raise to an inner function

(TRY301)


73-73: Abstract raise to an inner function

(TRY301)


79-79: Use explicit conversion flag

Replace with conversion flag

(RUF010)


114-114: Do not catch blind exception: Exception

(BLE001)


118-118: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


119-119: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


121-121: Abstract raise to an inner function

(TRY301)


127-127: Abstract raise to an inner function

(TRY301)


139-139: Use explicit conversion flag

Replace with conversion flag

(RUF010)

@Saahi30
Copy link
Collaborator Author

Saahi30 commented Nov 3, 2025

@CodeRabbit review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
backend/app/api/routes/auth.py (1)

113-124: Fix inconsistent exception handling pattern.

The login endpoint catches broad Exception and uses hasattr checks (line 122), while the signup endpoint properly catches AuthApiError directly (line 45). This inconsistency creates fragile error handling and violates the established pattern.

Additionally:

  • AuthApiError is already imported (line 3) but not used here
  • The comment on line 121 says "Import AuthApiError if available" which is confusing since it's already imported
  • Missing exception chaining at lines 123-124 (Ruff B904 hints)

Apply this diff to align with the signup pattern:

         # 1. Authenticate user
         try:
             auth_resp = supabase_public.auth.sign_in_with_password({
                 "email": payload.email,
                 "password": payload.password
             })
             user = getattr(auth_resp, "user", None)
-        except Exception as e:
-            # Supabase Python SDK v2 raises exceptions for auth errors
-            # Import AuthApiError if available
-            if hasattr(e, "code") and e.code == "email_not_confirmed":
-                raise HTTPException(status_code=403, detail="Please verify your email before logging in.")
-            raise HTTPException(status_code=401, detail=str(e))
+        except AuthApiError as e:
+            if getattr(e, "code", None) == "email_not_confirmed":
+                raise HTTPException(status_code=403, detail="Please verify your email before logging in.") from e
+            raise HTTPException(status_code=401, detail=str(e)) from e
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bad59d0 and 5768858.

📒 Files selected for processing (1)
  • backend/app/api/routes/auth.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.14.3)
backend/app/api/routes/auth.py

51-51: Abstract raise to an inner function

(TRY301)


67-67: Do not catch blind exception: Exception

(BLE001)


74-77: Abstract raise to an inner function

(TRY301)


78-78: Abstract raise to an inner function

(TRY301)


84-84: Use explicit conversion flag

Replace with conversion flag

(RUF010)


119-119: Do not catch blind exception: Exception

(BLE001)


123-123: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


124-124: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


126-126: Abstract raise to an inner function

(TRY301)


132-132: Abstract raise to an inner function

(TRY301)


144-144: Use explicit conversion flag

Replace with conversion flag

(RUF010)

@Saahi30
Copy link
Collaborator Author

Saahi30 commented Nov 4, 2025

@CodeRabbit review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants